/*
 * scoped_ptr.cpp
 *
 *  Created on: Sep 29, 2012
 *      Author: liuyu
 */

#include <boost/smart_ptr.hpp>
#include <iostream>
#include <string>

using namespace std;
using namespace boost;

string * my_scoped_ptr() {
	scoped_ptr<string> sp(new string("Hello scoped_ptr!"));

	cout << "in my_scoped_ptr(): " << *sp << endl;

	cout << "in my_scoped_ptr(): " << *( sp.get() ) << endl;

	auto_ptr<string> auto_str(sp);

	return auto_str;
}

int main () {
	string * ps = my_scoped_ptr();
	assert( ps != 0);
	cout << "in main(): " << *ps << endl;
}

